<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="css/index.css">
		<script src="js/vue.min.js"></script>
	    <script src="js/vant.min.js"></script>
		<script src="html5plus://ready"></script>

	</head>
	<body>
		<div id="app">
			<header>
				
			</header>
			 <footer>
				<van-tabbar v-model="active" @change="tabchange" active-color="red">
					<van-tabbar-item icon="shop-o">首页</van-tabbar-item>
					<van-tabbar-item icon="apps-o">分类</van-tabbar-item>
					<van-tabbar-item icon="shopping-cart-o">购物车</van-tabbar-item>
					<van-tabbar-item icon="contact">个人中心</van-tabbar-item>
				</van-tabbar>
			</footer>
		</div>
				<script>
							var vm = new Vue({
								el: "#app",
								data: {
									active: 0,
									views: [{
											name: "home",
											url: "views/home.html"
										},
										{
											name: "class",
											url: "views/class.html"
										},
										{
											name: "shopping",
											url: "views/shopping.html"
										},
										{
											name: "myself",
											url: "views/myself.html"
										},
									],
								},
								methods: {
									tabchange: function() {
										plus.webview.show(this.views[this.active].name);
									}
								},
								mounted:function() {
									var _this = this;
									document.addEventListener('plusready', function() {
										//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"
										var currentWebView = plus.webview.currentWebview();
										for (var i = 0; i < _this.views.length; i++) {
											var tempWebView = plus.webview.create(_this.views[i].url, _this.views[i].name, {
												top: "0px",
												bottom: "50px",
												scrollIndicator: "none",
												zindex: 1
											});
											currentWebView.append(tempWebView);
										}
										plus.webview.show(_this.views[0].name);
									});
								}
							});
						</script>
					</body>
				</html>
